Method: Float#>
- Defined in:
- numeric.c
#>(other) ⇒ Boolean
Returns true if self is numerically greater than other:
2.0 > 1 # => true
2.0 > 1.0 # => true
2.0 > Rational(1, 2) # => true
2.0 > 2.0 # => false
Float::NAN > Float::NAN returns an implementation-dependent value.
1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 |
# File 'numeric.c', line 1723 VALUE rb_float_gt(VALUE x, VALUE y) { double a, b; a = RFLOAT_VALUE(x); if (RB_INTEGER_TYPE_P(y)) { VALUE rel = rb_integer_float_cmp(y, x); if (FIXNUM_P(rel)) return RBOOL(-FIX2LONG(rel) > 0); return Qfalse; } else if (RB_FLOAT_TYPE_P(y)) { b = RFLOAT_VALUE(y); #if MSC_VERSION_BEFORE(1300) if (isnan(b)) return Qfalse; #endif } else { return rb_num_coerce_relop(x, y, '>'); } #if MSC_VERSION_BEFORE(1300) if (isnan(a)) return Qfalse; #endif return RBOOL(a > b); } |